Automated template generation algorithm for implantable device

ABSTRACT

A method of generating a template in an implantable medical device for implantation within a patient, and a processor readable medium for performing the method, that includes generating a template corresponding to a supraventricular rhythm of the patient, determining whether the template is valid, and monitoring the template to determine whether the template is an accurate representation of the supraventricular rhythm. The template is created from non-paced R waves that are below a predetermined heart rate, and a statistical validation of the template is performed by evaluating the template based on matches against ongoing slow heart rhythm. The quality of the template is continuously monitored, similar to the statistical validation, with the exception that one thousand beats are evaluated and once more than thirty out of the last one hundred beats do not match the template within the threshold, an attempt is made to create a new template.

RELATED APPLICATIONS

A portion of this application claims priority and other benefits fromU.S. Provisional Patent Application Serial No. 60/253,555, filed Nov.28, 2000, entitled “AUTOMATED TEMPLATE GENERATION ALGORITHM FORIMPLANTABLE ICD”

FIELD OF THE INVENTION

The present invention relates generally to a physiological waveformmorphology discrimination method for use in an implantable medicaldevice, and in particular, the present invention relates to automaticcreation of a template for EGM morphology measurements in an implantablemedical device.

BACKGROUND OF THE INVENTION

In the medical fields of cardiology and electrophysiology, many toolsare used to assess the condition and function of a patient's heart,including the observed frequency, polarity and amplitudes of the PQRSTcomplex associated with a heart cycle. Such tools include classicexternal ECG systems for displaying and recording the characteristiclead ECG signals from skin electrodes placed on the patient's chest andlimbs, ambulatory ECG Holter monitors for continuously recording the ECGor segments thereof from a more limited set of skin electrodes for aperiod of time, and more recently developed completely implantablecardiac monitors or cardiac pacemakers andpacemaker/cardioverter/defibrillators (PCDs) or implantablecardioverter/defibrillators (ICDs) having the capability of recordingEGM segments or data derived from atrial and ventricular EGMS (A-EGMsand V-EGMs) for telemetry out to an external programmer for externalstorage and display.

One of the problems addressed in the design of implantable PCDs or ICDsis the avoidance of unnecessary electrical shocks delivered to apatient's heart in response to rapid heart rates caused by exercise(sinus tachycardia) or by atrial fibrillation. Such rhythms are knowncollectively as supraventricular tachycardias (SVTs). Studies have shownthat SVTs may occur in up to 30% of ICD patients. While ICDs aregenerally effective at identifying ventricular tachycardia events, theICD can occasionally deliver a therapy to treat what is detected asbeing a ventricular tachycardia when in fact the source of the event isrelated to a supraventricular tachycardia event. Since delivery of thetreatment is painful and disconcerting to the patient, deficiencies indistinguishing ventricular tachycardia events from supraventriculartachycardia events tends to be problematic, making the reduction of theincidences of inappropriate treatment highly desirable.

One approach to the problem of distinguishing between normal QRScomplexes present during SVTs from those indicative of a VT is to studythe morphology of the QRS complex and discriminate normal heart beatsfrom abnormal ones based on the similarity of the signal to a samplewaveform recorded from the normal heartbeat, typically referred to as atemplate. Since a normal QRS complex, or slow rate rhythm, is generallynarrower than the QRS complex during VT, or fast rate rhythm, one of theexisting methods to discriminate between VT and normal EGM waveforms isbased on the properly measured width of the QRS complex. By creating thetemplate based on information sensed from supraventricular rhythmcomplexes, the ICD is able to compare cardiac complexes sensed duringtachycardia episodes against the supraventricular rhythm template. Basedon the results of the comparison, the ICD is able to classify thetachycardia episodes as being either a VT complex or a SVT complex, anddelivers therapy according to the classification.

In theory, the shape of the QRS complex in the EGM signal during SVTwill not change significantly in most patients, because ventriculardepolarizations are caused by normal HIS-Purkinje conduction from theatrium to the ventricle. If high ventricular rates are due to aventricular tachycardia (VT), one can expect a very different morphologyof the electrogram (EGM) signal of the ventricular depolarization (QRScomplex) because of a different pattern of electrical activity of theheart during VT. However, in certain instances, such as during theelectrode/tissue maturation process, or when the patient begins takingnew or additional medications, develops a myocardial infarction, orexperiences other physiological changes causing the electrical tissue ofthe patient to change, the morphology of the normal heart rhythm of thepatient may change from that originally used as a basis for creating thetemplate. As a result, since deviation from the “normal” heart rhythm ofthe patient occurs, the template begins to become corrupted, no longerbeing representative of the patient's current normal heart rhythm andtherefore causing the number of inappropriately delivered therapies toincrease.

In addition to reducing delivery of inappropriate therapy, another majorconsideration to be taken into account in the development of the ICD isthe limited battery power of the ICD that is available. Since thebatteries supplied in the ICD cannot be replaced after initialimplantation of the device without surgical procedures, the entire ICDmust typically be surgically replaced once the batteries becomedepleted, making it very desirable to conserve battery power of the ICD.As a result, one of the ways to conserve battery power is to reduce thecurrent drain by reducing the complexity of the signal processing thatmust be performed by the ICD, limiting the available solutions toreduction of inappropriate therapy delivery. Accordingly, what is neededis a method for reducing the instances of inappropriate therapy deliverythat maximizes conservation of the battery power of the device.

SUMMARY OF THE INVENTION

The present invention relates to a method of generating a template in animplantable medical device for implantation within a patient, and aprocessor readable medium for performing the method, that includesgenerating a template corresponding to a supraventricular rhythm of thepatient, determining whether the template is valid, and monitoring thetemplate to determine whether the template is an accurate representationof the supraventricular rhythm.

According to a preferred embodiment of the present invention, the stepof generating a template includes determining whether beatscorresponding to the heart rate of a patient are one of a paced beat andless than a predetermined rate, determining whether a predeterminednumber of beats have been collected and computing cross matches betweenthe predetermined number of collected beats to form correspondingcomputed cross matches, and determining whether a predetermined numberof the computed cross matches exceed a threshold. The template is formedfrom the predetermined number of computed cross matches in response tothe predetermined number of the computed cross matches exceeding thethreshold.

According to a preferred embodiment of the present invention, the stepof generating the template further comprises, in response to beatscorresponding to the heart rate not being one of a paced beat and lessthan a predetermined rate, the step of determining whether an RRinterval corresponding to the beats is within a predetermined thresholdof an average RR interval.

The step of determining whether the template is valid includes computinga match between subsequently collected beats and the template,determining whether the match is within a predetermined threshold toform matched beats and other than matched beats, and determining whetherthe other than matched beats is greater than a first number of beats.The template is determined to be valid in response to the matched beatsbeing greater than or equal to a second number of beats. Finally, thestep of monitoring the template includes (a) computing a match between asubsequently collected beat and the template, (b) determining whetherthe match is within a predetermined threshold to form matched beats andother than matched beats, (c) determining whether x out of the last ysubsequently collected beats are other than matched beats, and (d)repeating steps (a)-(c) in response to x out of the last y beats notbeing other than matched beats.

According to a preferred embodiment of the present invention, a methodof generating a template from beats corresponding to a supraventricularrhythm of a patient in an implantable medical device includes (a)determining whether six beats have been collected and computing crossmatches between the six collected beats to form corresponding computedcross matches, (b) determining whether four of the computed crossmatches exceeds a first predetermined threshold, (c) forming thetemplate from the four computed cross matches in response to the fourcomputed cross matches exceeding the first predetermined threshold, (d)determining whether a first time limit has been exceeded and repeatingsteps (a)-(c) in response to the four computed cross matches notexceeding the first predetermined threshold, (e) computing a first matchbetween one out of a hundred subsequently collected beats and thetemplate to form first matches, (f) determining whether the first matchis within a second predetermined threshold to form first matched beatsand second unmatched beats, (g) repeating steps (a)-(f) in response tothirty out of the last one hundred subsequently collected beats beingfirst unmatched beats, (h) determining the template is valid in responseto seventy out of the last one hundred subsequently collected beatsbeing first matched beats, (i) determining whether a second time limithas been exceeded and repeating steps (e)-(h) in response to seventy outof the last one hundred subsequently collected beats not being firstmatched beats, (j) computing a second match between one out of onethousand next subsequently collected beats and the template to form asecond match, (k) determining whether the second match is within a thirdpredetermined threshold to form second matched beats and secondunmatched beats, (l) repeating steps (j)-(k) in response to thirty outof the last one hundred next subsequently collected beats not beingunmatched beats, and (m) repeating steps (a)-(l) in response to thirtyout of the last one hundred next subsequently collected beats beingunmatched beats.

BRIEF DESCRIPTION OF THE DRAWINGS

The features of the present invention which are believed to be novel areset forth with particularity in the appended claims. The invention,together with further objects and advantages thereof, may best beunderstood by making reference to the following description, taken inconjunction with the accompanying drawings, in the several figures ofwhich like reference numerals identify like elements, and wherein:

FIG. 1 illustrates an implantable medical device and its associated leadsystem, as implanted in and adjacent to the heart.

FIG. 2 is a functional schematic diagram of an implantable medicaldevice in which the present invention may usefully be practiced.

FIG. 3 is a flowchart of generation of a template for an implantablemedical device according to the present invention.

FIG. 4 is a flowchart of generation of a template for an implantablemedical device according to the present invention.

FIG. 5 is a flowchart of generation of a template for an implantablemedical device according to an alternate preferred embodiment of thepresent invention.

FIG. 6 is a flowchart of statistical validation of a template for animplantable medical device according to an alternate preferredembodiment of the present invention.

FIG. 7 is a flowchart of monitoring of template quality for animplantable medical device according to the present invention.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

FIG. 1 is a schematic diagram of an implantable medical device forutilizing the template generation according to the present invention. Asillustrated in FIG. 1, an implantable medical device 100, such as apacemaker/cardioverter/defibrillator includes a lead system having acoronary sinus lead 110, a right ventricular lead 120, and asubcutaneous lead (not shown). Coronary sinus lead 110 is provided withan elongated electrode located in the coronary sinus and great veinregion at 112, extending around the heart until approximately the pointat which the great vein turns downward toward the apex of the heart.Right ventricular lead 120 includes two elongated defibrillationelectrodes 122 and 128, a ring electrode 124, and helical electrode 126,which is screwed into the tissue of the right ventricle at the rightventricular apex. A housing 102 of defibrillator 100 may serve as anadditional electrode.

In conjunction with the present invention, the lead system illustratedprovides electrodes that may be used to detect electrical activity inthe ventricles. For example, ring electrode 124 and tip electrode 126may be used to detect the occurrence of an R-wave and ring electrode 124and a subcutaneous defibrillation electrode (not shown) may be used toprovide an EGM signal stored in response to R-wave detect.Alternatively, electrodes 124 and 126 may be used for both R-wavedetection and as a source for the stored digitized EGM signal used formorphology analysis. According to a preferred embodiment of the presentinvention, electrodes 122 and 102 are utilized for morphology analysis.Other electrode configurations may also be employed. In alternativeembodiments in which atrial depolarizations are of interest, sensingelectrodes would correspondingly be placed in or adjacent the patientsatria.

FIG. 2 is a functional schematic diagram of an implantable medicaldevice in which the present invention may usefully be practiced. Thisdiagram should be taken as exemplary of the type of device in which theinvention may be embodied, and not as limiting, as it is believed thatthe invention may usefully be practiced in a wide variety of deviceimplementations, including devices having functional organizationsimilar to any of the implantable pacemaker/cardioverter/defibrillatorspresently being implanted for clinical evaluation in the United States.The invention is also believed practicable in conjunction withimplantable pacemaker/cardioverters/defibrillators as disclosed in priorU.S. Pat. No. 4,548,209, issued to Wielders, et al. on Oct. 22, 1985,U.S. Pat. No. 4,693,253, issued to Adams et al. on Sep. 15, 1987, U.S.Pat. No. 4,830,006, issued to Haluska et al. on May 6, 1989 and U.S.Pat. No. 4,949,730, issued to Pless et al. on Aug. 21, 1990, all ofwhich are incorporated herein by reference in their entireties.

The device is illustrated as being provided with six electrodes, 500,502, 504, 506, 508 and 510. Electrodes 500 and 502 may be a pair ofelectrodes located in the ventricle, for example, corresponding toelectrodes 124 and 126 in FIG. 1. Electrode 504 may correspond to aremote, electrode located on the housing of the implantablepacemaker/cardioverter/defibrillator. Electrodes 506, 508 and 510 maycorrespond to the large surface area defibrillation electrodes locatedon the ventricular and coronary sinus leads illustrated in FIG. 1 or toepicardial or subcutaneous defibrillation electrodes.

Electrodes 500 and 502 are shown as hard-wired to the R-wave detectorcircuit which includes a band pass amplifier 514, an auto-thresholdcircuit 516 for providing an adjustable sensing threshold as a functionof the measured R-wave amplitude and a comparator 518. A signal isgenerated on R-out line 564 whenever the signal sensed betweenelectrodes 500 and 502 exceeds the present sensing threshold defined byauto threshold circuit 516. As illustrated, the gain on the band passamplifier 514 is also adjustable by means of a signal from the pacertiming/control circuitry 520 on GAIN ADJ line 566.

The operation of this R-wave detection circuitry may correspond to thatdisclosed in U.S. Pat. No. 5,117,824 by Keimel, et al., issued Jun. 2,1992, incorporated herein by reference in its entirety. However,alternative R-wave detection circuitry such as that illustrated in U.S.Pat. No. 4,819,643, issued to Menken on Apr. 11, 1989 and U.S. Pat. No.4,880,004, issued to Baker et al. on Nov. 14, 1989, both incorporatedherein by reference in their entireties, may also usefully be employedto practice the present invention.

Threshold adjustment circuit 516 sets a threshold corresponding to apredetermined percentage of the amplitude of a sensed R-wave, with thethreshold decaying to a minimum threshold level over a period of lessthan three seconds thereafter, similar to the automatic sensingthreshold circuitry illustrated in the article “Reliable R-WaveDetection from Ambulatory Subjects”, by Thakor et al., published inBiomedical Science Instrumentation, Vol. 4, pp 67-72, 1978, incorporatedherein by reference in its entirety. An improved version of such anamplifier is disclosed in U.S. patent application Ser. No. 09/250,065,filed Feb. 12, 1999 by Rajasekhar, et al., for an “Implantable Devicewith Automatic Sensing Adjustment”, also incorporated herein byreference in its entirety. The invention may also be practiced inconjunction with more traditional R-wave sensors of the type comprisinga band pass amplifier and a comparator circuit to determine when theband-passed signal exceeds a predetermined, fixed sensing threshold.

Switch matrix 512 is used to select which of the available electrodesmake up the second electrode pair for use in conjunction with thepresent invention. The second electrode pair may include electrode 502or 500 in conjunction with electrode 504, 506, 508 or 510, or mayinclude other combinations of the illustrated electrodes, includingcombinations of the large surface defibrillation electrodes 506, 508,510. Selection of which two electrodes are employed as the secondelectrode pair in conjunction with R-wave width measurement function iscontrolled by the microprocessor 524 via data/address bus 540. Signalsfrom the selected electrodes are passed through band-pass amplifier 534and into multiplexer 532, where they are converted to multi-bit digitalsignals by A/D converter 530, for storage in random access memory 526under control of direct memory address circuit 528. Microprocessor 524employs the digitized EGM signal stored in random access memory 526 inconjunction with the morphology analysis method utilized. For example,the microprocessor 524 may analyze the EGM stored in an intervalextending from 100 milliseconds previous to the occurrence of an R-wavedetect signal on line 564, until 100 milliseconds following theoccurrence of the R-wave detect signal. Alternatively, microprocessormay 524 may analyze the width of the patient's R-wave to generate thetemplate, as described, for example, in U.S. Pat. No. 5,312,441, issuedto Mader et al. on May 17, 1994, and incorporated herein by reference init's entirety. The operation of microprocessor 524 in performing thetemplate generation method of the present invention is controlled bymeans of software stored in ROM, associated with microprocessor 524.

The remainder of the circuitry is dedicated to the provision of cardiacpacing, cardioversion and defibrillation therapies. Pacer timing/controlcircuitry 520 includes programmable digital counters which control thebasic time intervals associated with VVI mode cardiac pacing, includingthe pacing escape intervals, the refractory periods during which sensedR-waves are ineffective to restart timing of the escape intervals andthe pulse width of the pacing pulses. The durations of these intervalsare determined by microprocessor 524, and are communicated to pacingcircuitry 520 via address/data bus 540. Pacer timing/control circuitry520 also determines the amplitude of the cardiac pacing pulses and thegain of band-pass amplifier, under control of microprocessor 524.

During VVI mode pacing, the escape interval counter within pacertiming/control circuitry 520 is reset upon sensing of an R-wave asindicated by a signal on line 564, and on timeout triggers generation ofa pacing pulse by pacer output circuitry 522, which is coupled toelectrodes 500 and 502. The escape interval counter is also reset ongeneration of a pacing pulse, and thereby controls the basic timing ofcardiac pacing functions, including anti-tachycardia pacing. Theduration of the interval defined by the escape interval timer isdetermined by microprocessor 524, via data/address bus 540. The value ofthe count present in the escape interval counter when reset by sensedR-waves may be used to measure the duration of R—R intervals, to detectthe presence of tachycardia and to determine whether the minimum ratecriteria are met for activation of the width measurement function.

Microprocessor 524 operates as an interrupt driven device, under controlof software stored in the ROM associated with microprocessor 524 andresponds to interrupts from pacer timing/control circuitry 520corresponding to the occurrence of sensed R-waves and corresponding tothe generation of cardiac pacing pulses. These interrupts are providedvia data/address bus 540. Any necessary mathematical calculations to beperformed by microprocessor 524 and any updating of the values orintervals controlled by pacer timing/control circuitry 520 take placefollowing such interrupts. These calculations include those described inmore detail below associated with the discrimination methods of thepresent invention.

In the event that a tachycardia is detected, and an anti-tachycardiapacing regimen is desired, appropriate timing intervals for controllinggeneration of antitachycardia pacing therapies are loaded frommicroprocessor 524 into pacer timing/control circuitry 520, to controlthe operation of the escape interval counter and to define refractoryperiods during which detection of an R-wave by the R-wave detectioncircuitry is ineffective to restart the escape interval counter.Similarly, in the event that generation of a cardioversion ordefibrillation pulse is required, microprocessor 524 employs thecounters to in pacer timing/control circuitry 520 to control timing ofsuch cardioversion and defibrillation pulses, as well as timing ofassociated refractory periods during which sensed R-waves areineffective to reset the timing circuitry.

In response to the detection of fibrillation or a tachycardia requiringa cardioversion pulse, microprocessor 524 activatescardioversion/defibrillation control circuitry 554, which initiatescharging of the high voltage capacitors 556, 558, 560 and 562 viacharging circuit 550, under control of high voltage charging line 552.The voltage on the high voltage capacitors is monitored via VCAP line538, which is passed through multiplexer 532, and, in response toreaching a predetermined value set by microprocessor 524, results ingeneration of a logic signal on CAP FULL line 542, terminating charging.Thereafter, delivery of the timing of the defibrillation orcardioversion pulse is controlled by pacer timing/control circuitry 520.One embodiment of an appropriate system for delivery and synchronizationof cardioversion and defibrillation pulses, and controlling the timingfunctions related to them is disclosed in more detail in U.S. Pat. No.5,188,105, issued to Keimel on Feb. 23, 1993 and incorporated herein byreference in its entirety. However, any known cardioversion ordefibrillation pulse generation circuitry is believed usable inconjunction with the present invention. For example, circuitrycontrolling the timing and generation of cardioversion anddefibrillation pulses as disclosed in U.S. Pat. No. 4,384,585, issued toZipes on May 24,1983, in U.S. Pat. No. 4,949,719 issued to Pless et al.,cited above, and in U.S. Pat. No. 4,375,817, issued to Engle et al., allincorporated herein by reference in their entireties may also beemployed. Similarly, known circuitry for controlling the timing andgeneration of antitachycardia pacing pulses as described in U.S. Pat.No. 4,577,633, issued to Berkovits et al. on Mar. 25, 1986, U.S. Pat.No. 4,880,005, issued to Pless et al. on Nov. 14, 1989, U.S. Pat. No.7,726,380, issued to Vollmann et al. on Feb. 23, 1988 and U.S. Pat. No.4,587,970, issued to Holley et al. on May 13, 1986, all of which areincorporated herein by reference in their entireties may also be used.

In modern pacemaker/cardioverter/defibrillators, the particularantitachycardia and defibrillation therapies are programmed into thedevice ahead of time by the physician, and a menu of therapies istypically provided. For example, on initial detection of tachycardia, ananti-tachycardia pacing therapy may be selected. On redetection oftachycardia, a more aggressive anti-tachycardia pacing therapy may bescheduled. If repeated attempts at anti-tachycardia pacing therapiesfail, a higher-level cardioversion pulse therapy may be selectedthereafter. Prior art patents illustrating such pre-set therapy menus ofanti-tachyarrhythmia therapies include the above-cited U.S. Pat. No.4,830,006, issued to Haluska, et al., U.S. Pat. No. 4,727,380, issued toVollmann et al. and U.S. Pat. No. 4,587,970, issued to Holley et al. Thepresent invention is believed practicable in conjunction with any of theknown anti-tachycardia pacing and cardioversion therapies, and it isbelieved most likely that the invention of the present application willbe practiced in conjunction with a device in which the choice and orderof delivered therapies is programmable by the physician, as in currentimplantable pacemaker/cardioverter/defibrillators.

In the present invention, selection of the particular electrodeconfiguration for delivery of the cardioversion or defibrillation pulsesis controlled via output circuit 548, under control ofcardioversion/defibrillation control circuitry 554 via control bus 546.Output circuit 548 determines which of the high voltage electrodes 506,508 and 510 will be employed in delivering the defibrillation orcardioversion pulse regimen, and may also be used to specify amultielectrode, simultaneous pulse regimen or a multi-electrodesequential pulse regimen. Monophasic or biphasic pulses may begenerated. One example of circuitry which may be used to perform thisfunction is set forth in U.S. Pat. No. 5,163,427, issued to Keimel onNov. 17, 1992, incorporated herein by reference in its entirety.However, output control circuitry as disclosed in U.S. Pat. No.4,953,551, issued to Mehra et al. on Sep. 4, 1990 or U.S. Pat. No.4,800,883, issued to Winstrom on Jan. 31, 1989 both incorporated hereinby reference in their entireties, may also be used in the context of thepresent invention. Alternatively single monophasic pulse regimensemploying only a single electrode pair according to any of theabove-cited references that disclose implantable cardioverters ordefibrillators may also be used.

As discussed above, switch matrix 512 selects which of the variouselectrodes are coupled to band pass amplifier 534. Amplifier 534 may bea band- pass amplifier, having a band pass extending for approximately2.5 to 100 hertz. The filtered EGM signal from amplifier 534 is passedthrough multiplexer 532, and digitized in A-D converter circuitry 530.The digitized EGM data is stored in random access memory 526 undercontrol of direct memory address circuitry 528. Preferably, a portion ofrandom access memory 526 is configured as a looping or buffer memory,which stores at least the preceding several seconds of the EGM signal.

The occurrence of an R-wave detect signal on line 564 is communicated tomicroprocessor 524 via data/address bus 540, and microprocessor 524notes the time of its occurrence. If the morphology analysis function isactivated, microprocessor 524 may, for example, wait 100 milliseconds orother physician selected interval following the occurrence of the R-wavedetect signal, and thereafter transfer the most recent 200 millisecondsor other physician selected interval of digitized EGM stored in thelooping or buffer memory portion of the random access memory circuit 526to a second memory location, where the contents may be digitallyanalyzed according to the present invention. In this case, thetransferred 200 milliseconds of stored EGM will correspond to a timewindow extending 100 milliseconds on either side of the R-wave detectsignal. Window sizes in any case should be sufficient to allow analysisof the entire QRS complexes associated with the detected R-waves. Themicroprocessor also updates software-defined counters that holdinformation regarding the R—R intervals previously sensed. The countersare incremented on the occurrence of a measured R—R intervals fallingwithin associated rate ranges. These rate ranges may be defined by theprogramming stored in the RAM 526

The following exemplary VT/VF detection method corresponds to thatemployed in commercially marketed Medtronic implantablepacemaker/cardioverter/defibrillators and employs rate/interval basedtiming criteria as a basic mechanism for detecting the presence of atachyarrhythmia. To this end, the device defines a set of rate rangesand associated software-defined counters to track the numbers ofintervals falling within the defined ranges.

A first rate range may define a minimum R—R interval used forfibrillation detection, referred to as “FDI”. The associated VF countpreferably indicates how many of a first predetermined number of thepreceding R—R intervals were less than FDI.

A second rate range may include R—R intervals less than a lowertachycardia interval “TDI”, and the associated VT count (VTEC) isincremented in response to an R—R interval less than TDI but greaterthen FDI, is not affected by R—R intervals less than FDI, and is resetin response to R—R intervals greater than TDI.

Optionally, the device may include a third rate range including R—Rintervals greater than the FDI interval, but less than a fasttachycardia interval (FTDI) which is intermediate the lower tachycardiainterval (TDI) and the lower fibrillation interval (FDI).

For purposes of the present example, the counts may be used to signaldetection of an associated arrhythmia (ventricular fibrillation, fastventricular tachycardia or lower rate ventricular tachycardia) when theyindividually or in combination reach a predetermined value, referred toherein as “NID's” (number of intervals required for detection). Eachrate zone may have its own defined count and NID, for example “VFNID”for fibrillation detection and “VTNID” for ventricular tachycardiadetection or combined counts may be employed. These counts, along withother stored information reflective of the previous series of R—Rintervals such as information regarding the rapidity of onset of thedetected short R—R intervals, the stability of the detected R—Rintervals, the duration of continued detection of short R—R intervals,the average R—R interval duration and information derived from analysisof stored EGM segments are used to determine whether tachyarrhythmia arepresent and to distinguish between different types of tachyarrhythmia.

For purposes of illustrating the invention, an exemplary rate/intervalbased ventricular tachyarrhythmia detection method is described above.Other tachyarrhythmia detection methodologies, including detectionmethods as described in U.S. Pat. No. 5,991,656, issued to Olson, et al.on Nov. 23, 1999, U.S. Pat. No. 5,755,736, issued to Gillberg, et al. onMay 26, 1998, both incorporated herein by reference in their entireties,or other known ventricular and/or atrial tachyarrhythmia detectionmethods may be substituted. It is believed that the discriminationmethods of the present invention may be usefully practiced inconjunction with virtually any underlying atrial or ventriculartachyarrhythmia detection scheme. Other exemplary detection schemes aredescribed in U.S. Pat. No. 4,726,380, issued to Vollmann, U.S. Pat. No.4,880,005, issued to Pless et al., U.S. Pat. No. 4,830,006, issued toHaluska et al., and U.S. patent application Ser. No. 09/566,477, filedMay 8, 2000 by Gillberg et al., all incorporated by reference in theirentireties herein. An additional set of tachycardia recognitionmethodologies is disclosed in the article “Onset and Stability forVentricular Tachyarrhythmia Detection in an ImplantablePacer-Cardioverter-Defibrillator” by Olson et al., published inComputers in Cardiology, Oct. 7-10, 1986, IEEE Computer Society Press,pages 167-170, also incorporated by reference in its entirety herein.However, other criteria may also be measured and employed in conjunctionwith the present invention.

FIG. 3 is a flowchart of generation of a template for an implantablemedical device according to the present invention. As illustrated inFIGS. 2 and 3, generation of a supraventricular rhythm templateaccording to the present invention is initiated by microprocessor 524,either automatically or manually at Step 160, using R-waves of thedigitized EGM signals stored in random access memory 526. The generationof the template is initiated, for example, when no template currentlyexists, or upon recognition, either automatically by the implantablemedical device, or manually by a physician, that the current template isno longer accurate, as will be described below. Once the automatictemplate generation process is initiated in Step 160, and a template iscreated, Step 162, a determination is then made as to whether thecreated template is valid, Steps 164 and 166. If it is determined thatthe template is not valid, No in Step 166, the template is discarded andthe process returns to step 160 to create a new template. However, if itis determined that the template is valid, YES in Step 166, the templateis copied in a permanent position, Step 168. According to the presentinvention, once created, the quality of the valid template continues tobe monitored, Step 170, and a determination is made in Step 172 as towhether the template continues to be a valid template, i.e., whether thetemplate is an accurate representation of a supraventricular rhythm ofthe patient. If it is determined in Steps 170 and 172 that the templateis no longer valid, No in Step 172, the process returns to step 160 tocreate a new template. Once the new template is created and validated inSteps 162-166, the new template is copied in the permanent position,Step 168, replacing the previous template, and the quality of the newtemplate is monitored, Steps 170 and 172. On the other hand, if it isdetermined that the template is valid, i.e., that the template continuesto be an accurate representation of a supraventricular rhythm of thepatient, YES in Step 12, the device continues to monitor the templatequality, Step 170, and so on.

FIG. 4 is a flowchart of generation of a template for an implantablemedical device according to the present invention. As illustrated inFIGS. 2 and 4, a process for generation of a supraventricular rhythmtemplate according to the present invention is initiated bymicroprocessor 524, either automatically or manually, using R-waves ofthe digitized EGM signals stored in random access memory 526 at regularintervals. The template generation process is initiated, for example,when no template currently exists, or upon recognition, eitherautomatically by the implantable medical device, or manually by aphysician, that the current template is no longer accurate, as will bedescribed below. Upon initiation of the automatic template generationprocess, microprocessor 524 sets counters corresponding to the number ofbeats collected, the matched beats collected, and the average R-wave tozero, Step 200 and begins monitoring the heart rate of the patient, Step202.

Microprocessor 524 next determines whether a beat is a normal beat bydetermining whether the beat is a paced beat or has an R—R interval lessthan 600 ms, Step 204. If the beat is determined to be a paced beat orto have an R_R interval below 600 ms in Step 204, and therefore not anormal beat, a determination is made as to whether a predetermined timeperiod has been exceeded, Step 206, so that if the amount of timerequired to collect the number of normal beats required to create thetemplate exceeds a predetermined threshold, the template generationprocess will be aborted and the VT/SVT discrimination algorithmutilizing EGM morphology may be set to PASSIVE mode (if there is atemplate already created within the device) or to OFF mode, and attemptsto create a new template will be repeated after a predetermined timeperiod has expired.

If the beat is determined to be a normal beat, i.e., the beat is neithera paced beat or has an R—R interval less than 600 ms, a determination ismade as to whether six beats have been collected, Step 208, and theprocess continues until six normal beats have been collected. Once thesix normal beats are collected, microprocessor 524 computes crossmatches between the collected beats, Step 210. For example, according tothe present invention, the first beat is matched against the secondthrough sixth beats to generate five cross matches. A determination isthen made as to whether four or more of the computed cross matches aresimilar within a predetermined threshold, Step 212. For example,according to a preferred embodiment of the present invention, thepredetermined threshold of Step 212 is nominally 70%, although any valuecould be chosen without deviating from the present invention. If four ormore of the computed cross matches are not similar within thepredetermined threshold, a determination is made as to whether apredetermined time period, such as one hour for example, or apredetermined number of attempts, such as three for example, has beenexceeded, Step 206, so that if the amount of time required to collectthe number of cross matches required to create the template exceeds apredetermined threshold, the template generation process will be abortedand the VT/SVT discrimination algorithm utilizing EGM morphology may beset to PASSIVE mode (if there is a template already created within thedevice) or to OFF mode, and attempts to create a new template will berepeated after a predetermined time period has expired. However, if itis determined in Step 212 that four or more of the computed crossmatches are similar within the predetermined threshold, the four or morecross matches that are similar within the predetermined threshold areaveraged to create an average R wave snapshot, Step 214, that is thenused as the template.

FIG. 5 is a flowchart of generation of a template for an implantablemedical device according to an alternate preferred embodiment of thepresent invention. According to an alternate embodiment of the presentinvention, the automatic template generation process is similar to theprocess described above in reference to FIG. 4, although an additionalstep is included in the alternate embodiment to exclude prematureventricular contractions. In particular, as illustrated in FIG. 5, ifthe beat is determined to be a normal beat, i.e., the beat is neither apaced beat or has an R_R interval less than 600 ms in Step 204, adetermination is made as to whether the RR interval is greater than apredetermined average R—R interval, Step 205. In particular, accordingto a preferred embodiment of the present invention, a determination ismade as to whether the R—R interval is greater than approximately 85% ofthe average R—R interval. However, it is understood that any percentagevalue could be chosen as long as the chosen percentage value serves toexclude premature ventricular contractions.

If it is determined in Step 205 that the R—R interval is not greaterthan 85% of the average R—R interval, i.e., the likelihood that the beatis representative of a premature ventricular contraction is great, thebeat is excluded, and the process returns to Step 202 to monitor a nextbeat. On the other hand, if it is determined that the R—R interval isgreater than 85% of the average interval, i.e., it is not likely thatthe beat is representative of a premature ventricular contraction, theprocess continues at Step 208 as described above in FIG. 4. Since thesteps illustrated in FIG. 5, with the exception of Step 205, havepreviously been described above in reference to FIG. 4, description ofthe steps other than Step 205 has not been repeated merely for the sakeof brevity.

While the present invention is described above as computing crossmatches between beats once six beats have been collected, anddetermining whether four of the cross matches exceed the threshold, itis understood that the present invention is not limited to the use ofsix beats and four cross matches, but rather any number of beats andcross matches could be utilized, depending upon the particular patientor device requirements involved.

FIG. 6 is a flowchart of statistical validation of a template for animplantable medical device according to the present invention. Accordingto the present invention, once the average R wave is created in thetemplate generation stage described above for use as the template, thequality of the template is evaluated, based on matches between thetemplate and ongoing slow heart rhythm, which according to a preferredembodiment of the present invention, is chosen as being 100 bpm. It isunderstood that any rate could be chosen as the slow heart rhythm forthe statistical validation or creation of the template, and thereforethe invention is not limited to 100 bpm.

As illustrated in FIGS. 2 and 6, once the template has been generated,microprocessor 524 sets counters corresponding to the total beat number,the number of matched beats, and the number of bad beats to zero, Step216. Microprocessor then collects one normal beat from every N beats,where N is equal to one hundred, Step 218, and computes a match betweenthe collected beat and the template, Step 220. A determination is thenmade as to whether the collected beat matches the template within apredetermined threshold, Step 222. For example, according to the presentinvention, a determination is made as to whether the collected beatmatches are nominally within approximately 70% of a predeterminedthreshold. However, the threshold is not limited to this value, andcould be programmed as determined by a physician. If the collected beatdoes not match the template within the threshold, the beat is labeled asan unmatched beat, Step 224 and a determination is made as to whether xout of the last y number of beats have been labeled as unmatched beats,Step 226. If x out of the last y number of beats are unmatched beats,YES in Step 226, the template is determined to be invalid, Step 232 andthe template generation process is repeated, i.e., the process returnsto portion A of FIG. 4 or FIG. 5.

On the other hand, if the collected beat does match the template withinthe threshold, YES in Step 222, the beat is labeled as a matched beat,Step 228. Once the beat is labeled as a matched beat, Step 228, or it isdetermined that x out of the last y number of beats are not unmatchedbeats in Step 226, a determination is made as to whether x′ out of thelast y number of beats are matched beats, Step 230. If x′ out of thelast y number of beats are not matched beats, a determination as made asto whether a predetermined time period has been exceeded, Step 236, sothat after a predetermined number of unsuccessful attempts tostatistically validate the template, the template generation processwill be aborted and the VT/SVT discrimination algorithm utilizing theEGM morphology may be set to PASSIVE mode (if there is a templatealready created within the device) or to OFF mode, and attempts tocreate a new template will be repeated after a predetermined time periodhas expired.

However, if it is determined in Step 236 that the predetermined timeperiod has not been exceeded, microprocessor 524 collects another beatand the process is repeated, Step 218. In this way, the statisticalvalidation portion is continued until x′ number of beats are determinedto be matched beats or until x number of beats are determined to beunmatched beats, whichever occurs first, either within y number of beatsor within the time limit. Once x′ out of y number of beats aredetermined to be within the threshold, the template is accepted asvalid, Step 234, and is then copied into the location where the templateis used by microprocessor 524 to perform the morphology discrimination.However, if x out of y number of beats are determined to not be withinthe threshold prior to determining that x′ out of y number of beats arewithin the threshold at Step 222, the process returns to Step A and anew template is generated.

According to a preferred embodiment of the present invention, the xnumber of beats is equal to thirty, the x′ number of beats is equal toseventy, and the y number of beats is equal to one hundred, so that adetermination is made in Step 226 as to whether thirty out of the lastone hundred collected beats are unmatched beats and 230 as to whetherseventy out of the last one hundred collected beats are matched beats inStep 230 of FIG. 6. However, it is understood that, according to thepresent invention, the values for x, x′, and y is not limited to thirty,seventy, and one hundred, respectively. Rather, the present invention isintended to include the use of any number of beats of last collectedbeats to monitor the quality of the template and determine whether thetemplate is valid.

FIG. 7 is a flowchart of monitoring of template quality for animplantable medical device according to the present invention. Asillustrated in FIGS. 2 and 7, once microprocessor 524 determines thatthe template is validated (Step C in FIG. 6), microprocessor 524 setscounters corresponding to the total number of beats, the number ofevaluated beats, the number of matched beats, and the number of badbeats to zero, Step 236. Microprocessor 524 then collects one normal,regular beat from every N beats, where N is equal to one thousand, Step238, and computes a match between the beat and the template, Step 240.Once the match between the beat and the template is computed,microprocessor 524 determines whether the collected beat matches thetemplate within a predetermined threshold, Step 242. If the collectedbeat does not match the template within the threshold, the beat islabeled as a bad, or unmatched beat, Step 244 and a determination ismade as to whether x out of the last y number of beats are unmatchedbeats, Step 246. If x out of the last y number of beats are unmatchedbeats, the template is determined to be invalid, and the templategeneration process is repeated, i.e., the process returns to portion Aof FIG. 4. On the other hand, if x of the last y number of beats are notunmatched beats in Step 246, another normal, regular beat from onethousand beats is collected, Step 238 and the process is repeated.

If the collected beat does match the template within the threshold, YESin Step 242, the beat is labeled as a good, or matched beat, Step 248,and the determination is made at Step 246 as to whether x of the last ynumber of beats are unmatched beats. If x out of the last y number ofbeats are unmatched beats, the template is determined to be invalid, andthe template generation process is repeated, i.e., the process returnsto portion A of FIG. 4. On the other hand, if x of the last y number ofbeats are not unmatched beats in Step 246, another normal, regular beatfrom one thousand beats is collected, Step 238 and the process isrepeated.

According to a preferred embodiment of the present invention, the xnumber of beats is equal to thirty and the y number of beats is equal toone hundred, so that a determination is made in Step 246 as to whetherthirty out of the last one hundred collected beats are unmatched beats.However, it is understood that, according to the present invention, thevalues for x and y is not limited to thirty and one hundred,respectively. Rather, the present invention is intended to include theuse of any number of beats of last collected beats to monitor thequality of the template and determine whether the template is valid.

In this way, the monitoring stage of the present invention, illustratedin FIG. 6, is similar to the statistical validation of the templatestage, illustrated in FIG. 7, with the exception that one out of everyone thousand beats are evaluated and once more than thirty out of thelast one hundred beats do not match the template within the threshold,an attempt is made to create a new template, Step A of FIG. 4. Inaddition, the monitoring stage is continuous unless x out of the last ybeats are determined to be unmatched beats in Step 246, i.e., thetemplate is invalid, in which case the process returns to portion A ofFIG. 4 to re-generate the template. While the characteristic time forthe monitoring stage of FIG. 7 is approximately 20-30 hours, if there isa change in the EGM morphology, the change will be picked up by thepresent invention in approximately one-third of this characteristic time(i.e., 16 to 24 hours), since it only takes 30 mismatches to reject thetemplate.

It is understood that while the present invention has been describedabove as validating a template once seventy matched beats have beencollected and invalidating the template once thirty collected beats donot match the template within a threshold, the present invention is notintended to be limited to requiring seventy out of one hundred beats tomatch the template within the threshold in order for the template to bedetermined to be statistically valid. Rather, any number of beats couldbe utilized in the statistical evaluation. Similarly, while the presentinvention has been described above as monitoring the quality of thetemplate once seventy matched beats have been collected out of onehundred beats over a total of one thousand beats, and invalidating thetemplate once thirty out of the last one hundred collected beats do notmatch the template within a threshold, any number of beats could beutilized in the monitoring of the quality of the template.

It is further understood that while the present invention has beendescribed in terms of its application to a single chamber system in FIG.1, the present invention is not intended to be limited to such singlechamber systems, but rather can be utilized in other systems, such asthe dual chamber system described, for example, in U.S. Pat. No.6,141,581 issued to Olson et al, on Oct. 31, 2000, incorporated hereinby reference in its entirety.

Finally, it is understood that while the beats that are collected inStep 238 of FIG. 7 and Step 218 of FIG. 6, are described as being oneout of one thousand and one out of one hundred, respectively, thepresent invention is not intended to be limited to those counts, butrather may utilize any number of counts, dependent upon physician and/orsystem requirements.

The preceding specific embodiments are illustrative of the practice ofthe invention. It is to be understood, therefore, that other expedientsknown to those of skill in the art or disclosed herein may be employed.In the following claims, means-plus-function clauses are intended tocover the structures described herein as performing the recited functionand not only structural equivalents but also equivalent structures. Forexample, although a nail and a screw may not be structural equivalentsin that a nail employs a cylindrical surface to secure wooden partstogether, whereas a screw employs a helical surface, in the environmentof fastening wooden parts, a nail and a screw are equivalent structures.It is therefore to be understood, that within the scope of the appendedclaims, the invention may be practiced otherwise than as specificallydescribed without actually departing from the spirit and scope of thepresent invention.

What is claimed is:
 1. A method of generating a template in an implantable medical device for implantation within a patient, comprising the steps of: monitoring a heart rate of the patient; determining whether beats corresponding to the heart rate are one of a paced beat and less than a predetermined rate; generating a template corresponding to a supraventricular rhythm of the patient in response to the beats determined to be one of a paced beat and less than a predetermined rate; determining whether the template is valid; and monitoring the template to determine whether the template is an accurate representation of the supraventricular rhythm.
 2. The method of claim 1, further comprising the steps of generating a new template in response to the template not being an accurate representation; and continuing to monitor the template in response to the template being an accurate representation.
 3. A method of generating a template in an implantable medical device for implantation within a patient, comprising: generating a template corresponding to a supraventricular rhythm of the patient; determining whether the template is valid; monitoring the template to determine whether the template is an accurate representation of the supraventricular rhythm, wherein the step of generating a template comprises the steps of: monitoring a heart rate of the patient; determining whether beats corresponding to the heart rate are one of a paced beat and less than a predetermined rate; determining whether a predetermined number of beats have been collected and computing cross matches between the predetermined number of collected beats to form corresponding computed cross matches; determining whether a predetermined number of the computed cross matches exceed a threshold; and forming the template from the predetermined number of computed cross matches in response to the predetermined number of the computed cross matches exceeding the threshold.
 4. The method of claim 3, further comprising the steps of: determining whether a predetermined time period has been exceeded in response to beats corresponding to the heart rate being one of a paced beat and less than the predetermined rate; and aborting the template generation in response to the predetermined time period being exceeded.
 5. The method of claim 3, further comprising the steps of: determining whether a predetermined time period has been exceeded in response to the predetermined number of computed cross matches not exceeding the predetermined threshold; and aborting the template generation in response to the predetermined time period being exceeded.
 6. The method of claim 3, wherein the predetermined number of beats is six and the predetermined number of computed cross matches is four.
 7. A method of generating a template in an implantable medical device for implantation within a patient comprising: generating a template corresponding to a supraventricular rhythm of the patient; determining whether the template is valid; monitoring the template to determine whether the template is an accurate representation of the supraventricular rhythm, wherein the step of generating a template comprises the steps of: monitoring a heart rate of the patient; determining whether beats corresponding to the heart rate are one of a paced beat and less than a predetermined rate; determining whether an RR interval corresponding to the beats is within a predetermined threshold of an average RR interval; determining whether a predetermined number of beats have been collected and computing cross matches between the predetermined number of collected beats to form corresponding computed cross matches; determining whether a predetermined number of the computed cross matches exceed a threshold; and forming the template from the predetermined number of computed cross matches in response to the predetermined number of the computed cross matches exceeding the threshold.
 8. A method of generating a template in an implantable medical device for implantation within a patient comprising: generating a template corresponding to a supraventricular rhythm of the patient; determining whether the template is valid; monitoring the template to determine whether the template is an accurate representation of the supraventricular rhythm, wherein the step of determining whether the template is valid comprises the steps of: computing a match between subsequently collected beats and the template; determining whether the match is within a predetermined threshold to form matched beets and other than matched beats; determining whether the other than matched beats is greater than a first number of beats; and determining the template is valid in response to the matched beats being greater than or equal to a second number of beats.
 9. The method of claim 8, wherein the step of computing a match comprises computing the match for one out of every one hundred subsequently collected beats and the template.
 10. The method of claim 8, wherein the step of determining whether the template is valid further comprises the step of repeating the step of generating a template in response to the other than matched beats being greater than the first number of beats.
 11. The method of claim 8, wherein the first number of beats is thirty and the second number of beats is seventy.
 12. The method of claim 8, further comprising, in response to the matched beats not being greater than or equal to the second number of beats, the steps of: determining whether a match has been computed for a predetermined number of beats; determining whether a time period has been exceeded in response to the match not being computed for the predetermined number of beats; and aborting the template generation in response to the predetermined time period being exceeded.
 13. The method of claim 12, wherein the first number of beats is thirty, the second number of beats is seventy, and the predetermined number of beats is one hundred.
 14. A method of generating a template in an implantable medical device for implantation within a patient, comprising: generating a template corresponding to a supraventricular rhythm of the patient; determining whether the template is valid; monitoring the template to determine whether the template is an accurate representation of the supraventricular rhythm, wherein the step of monitoring the template comprises the steps of: (a) computing a match between a subsequently collected beat and the template; (b) determining whether the match is within a predetermined threshold to form matched beats and other than matched beats; (c) determining whether x out of the last y subsequently collected beats are other than matched beats; and (d) repeating steps (a)-(c) in response to x out of the last y beats not being other than matched beats.
 15. The method of claim 14, wherein the step of computing a match comprises computing the match for one out of every one thousand subsequently collected beats and the template.
 16. The method of claim 14, further comprising the step of repeating the step of generating a template in response to x out of the last y beats being other than matched beats.
 17. The method of claim 14, wherein x is thirty and y is one hundred.
 18. A processor readable medium in an implantable medical device, comprising: means for monitoring a heart rate of the patient; means for determining whether beats corresponding to the heart rate are one of a paced beat and less than a predetermined rate; and means for generating a template corresponding to a supraventricular rhythm of the patient in response to the beats determined to be one of a paced beat and less than a predetermined rate, the means for generating a template further determining whether the template is valid and monitoring the template to determine whether the template is an accurate representation of the supraventricular rhythm.
 19. The processor readable medium of claim 18, wherein the generating means generates a new template in response to the template not being an accurate representation; and continues to monitor the template in response to the template being an accurate representation.
 20. The processor readable medium of claim 18, wherein the generating means determines whether an RR interval corresponding to the beats is within a predetermined threshold of an average RR interval.
 21. A processor readable medium in an implantable medical device comprising: means for sensing an R wave; and means for generating a template corresponding to a supraventricular rhythm of the patient based on the sensed R wave the means for generating a template further determining whether the template is valid and monitoring the template to determine whether the template is an accurate representation of the supraventricular rhythm, wherein the generating means monitors a heart rate of the patient, determines whether beats corresponding to the heart rate are one of a paced beat and less than a predetermined rate, determines whether a predetermined number of beats have been collected and computes cross matches between the predetermined number of collected beats to form corresponding computed cross matches, determines whether a predetermined number of the computed cross matches exceeds a threshold, and forms the template from the predetermined number of computed cross matches in response to the predetermined number of the computed cross matches exceeding the threshold.
 22. The processor readable medium of claim 21, wherein the generating means determines whether a predetermined time period has been exceeded in response to beats corresponding to the heart rate being one of a paced beat and less than a predetermined rate, and aborts the template generation in response to the predetermined time period being exceeded.
 23. The processor readable medium of claim 21, wherein the generating means generates a new template in response to the template not being an accurate representation; and continues to monitor the template in response to the template being an accurate representation, and wherein the genearating means determines whether a predetermined time period has been exceeded in response to the predetermined number of computed cross matches not exceeding the predetermined threshold, and aborts the template generation in response to the predetermined time period being exceeded.
 24. The processor readable medium of claim 21, wherein the generating means re-generates the template in response to x out of the last y beats being other than matched beats.
 25. A processor readable medium in an implantable medical device, comprising: means for sensing an R wave; and means for generating a template corresponding to a supraventricular rhythm of the patient based on the sensed R wave, the means for generating a template further determining whether the template is valid and monitoring the template to determine whether the template is an accurate representation of the supraventricular rhythm, wherein the generating means computes a match between subsequently collected beats and the template, determines whether the match is within a predetermined threshold to form matched beats and other than matched beats, and determines the validity of the template based on the number of matched beats and the number of other than matched beats.
 26. The processor readable medium of claim 25, wherein the generating means determines whether a match has been computed for a predetermined number of beats, determines whether a time period has been exceeded in response to the match not being computed for the predetermined number of beats, and aborts the template generation in response to the predetermined time period being exceeded.
 27. A processor readable medium in an implantable medical device, comprising: means for sensing an R wave; and means for generating a template corresponding to a supraventricular rhythm of the patient based on the sensed R wave, the means for generating a template further determining whether the template is valid and monitoring the template to determine whether the template is an accurate representation of the supraventricular rhythm, wherein the generating means (a) computes a match between subsequently collected beats and the template, (b) determines whether the match is within a predetermined threshold to form matched beats and other than matched beats, (c) determines whether x out of the last y subsequently collected beats are other than matched beats, and (d) repeats (a)-(c) in response to x out of the last y subsequently collected beats not being other than matched beats.
 28. The processor readable medium of claim 27, wherein the generating means computes the match for one out of every one thousand subsequently collected beats and the template.
 29. The processor readable medium of claim 27, wherein the x is thirty and y is one hundred.
 30. A method of generating a template in an implantable medical devise for implantation within a patient, comprising the steps of: (a) monitoring a heart rate of the patient; (b) determining whether beats corresponding to the heart rate are one of a paced beat and less than a predetermined rate; (c) determining whether a predetermined number of beats have been collected and computing cross matches between the predetermined number of collected beats to form corresponding computed cross matches; (d) determining whether a predetermined number of the computed cross matches exceeds a first predetermined threshold; (e) forming the template from the predetermined number of computed cross matches in response to the predetermined number of the computed cross matches exceeding the first predetermined threshold; (f) computing a first match between subsequently collected beats and the template to form first matches; (g) determining whether the first match is within a second predetermined threshold to form first matched beats and first other than matched beats; (h) determining whether the first other than matched beats is greater than a first number of beats; (i) determining the template is valid in response to the matched beats being equal to a second number of beats; (j)computing a second match between a next subsequently collected beat and the template to form a second match; (k) determining whether the second match is within a third predetermined threshold to form second matched beats and second other than matched beats; (l) determining whether x out of the last y next subsequently collected beats are other than matched beats; and (m) repeating steps (j)-(l) in response to x out of the last y next subsequently collected beats not being other than matched beats.
 31. The method of claim 30, further comprising the steps of repeating steps (a)-(e) in response to the first other than matched beats being greater than the first number of beats and in response to x out of the last y next subsequently collected beats being other than matched beats.
 32. The method of claim 31, wherein the step of computing a first match comprises computing the first match for one out of every one hundred of the subsequently collected beats and the step of computing a second match comprises computing the second match for one out of every one thousand of the next subsequently collected beats.
 33. The method of claim 32, further comprising the steps of: (n) determining whether a first time period has been exceeded in response to determining, in step (d), that the predetermined number of computed cross matches does not exceed the first predetermined threshold; (o) aborting the template generation in response to the predetermined time period being exceeded; (p) determining a total number of the first matches; (q) determining whether a second time period has been exceeded in response to the total number of first matches being less than a predetermined number of first matches; and (v) aborting the template generation in response to the second time period being exceeded.
 34. The method of claim 33, further comprising, in response to beats corresponding to the heart rate are not one of a paced beat and less than a predetermined rate, the step of determining whether an RR interval corresponding to the beats is within a predetermined threshold of an average RR interval.
 35. A method of generating a template from beats corresponding to a supraventricular rhythm of a patient in an implantable medical device, comprising the steps of: (a) determining whether six beats have been collected and computing cross matches between the six collected beats to form corresponding computed cross matches; (b) determining whether four of the computed cross matches exceeds a first predetermined threshold; (c) forming the template from the four computed cross matches in response to the four computed cross matches exceeding the first predetermined threshold; (d) determining whether a first time limit has been exceeded and repeating steps (a)-(c) in response to the four computed cross matches not exceeding the first predetermined threshold; (e) computing a first match between one out of a hundred subsequently collected beats and the template to form first matches; (f) determining whether the first match is within a second predetermined threshold to form, first matched beats and second unmatched beats; (g) repeating steps (a)-(f) in response to thirty out of the last one hundred subsequently collected beats being first unmatched beats; (h) determining the template is valid in response to seventy out of the last one hundred subsequently collected beats being first matched beats; (i) determining whether a second time limit has been exceeded and repeating steps (e)-(h) in response to seventy out of the last one hundred subsequently collected beats not being first matched beats; (j) computing a second match between one out of one thousand next subsequently collected beats and the template to form a second match; (k) determining whether the second match is within a third predetermined threshold to form second matched beats and second unmatched beats; (l) repeating steps (j)-(k) in response to thirty out of the last one hundred next subsequently collected beats not being unmatched beats; and (m) repeating steps (a)-(l) in response to thirty out of the last one hundred next subsequently collected beats being unmatched beats.
 36. The method of claim 35 further comprising the step of determining whether an RR interval corresponding to the beats is within a predetermined threshold of an average RR interval. 